<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>sgp4oo: Fichero Fuente sgp4_util.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generado por Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="annotated.html"><span>Clases</span></a></li>
      <li class="current"><a href="files.html"><span>Archivos</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;de&nbsp;archivos</span></a></li>
      <li><a href="globals.html"><span>Miembros&nbsp;de&nbsp;los&nbsp;ficheros</span></a></li>
    </ul>
  </div>
<h1>sgp4_util.cpp</h1><a href="sgp4__util_8cpp.html">Ir a la documentación de este archivo.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="preprocessor">#include &quot;<a class="code" href="sgp4__util_8h.html">sgp4_util.h</a>&quot;</span>
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 
<a name="l00005"></a><a class="code" href="classsgp4__util.html#a8143158a0b55b98d5e23d5cd34c62077">00005</a> <span class="keywordtype">bool</span> <a class="code" href="classsgp4__util.html#a8143158a0b55b98d5e23d5cd34c62077">sgp4_util::identicos</a>(<span class="keywordtype">char</span> carpeta[128],<span class="keywordtype">char</span> carpeta2[128]){
<a name="l00006"></a>00006 
<a name="l00007"></a>00007     DIR *dir;
<a name="l00008"></a>00008     <span class="keyword">struct </span>dirent *directorio;
<a name="l00009"></a>00009     <span class="keywordtype">char</span> cadena[128];
<a name="l00010"></a>00010     <span class="keywordtype">char</span> cadena2[128];
<a name="l00011"></a>00011     <span class="keywordtype">bool</span> iguales=<span class="keyword">true</span>;
<a name="l00012"></a>00012     <span class="keywordflow">if</span>((dir = opendir(carpeta)) == NULL){
<a name="l00013"></a>00013         perror(<span class="stringliteral">&quot;La ruta especificada no existe.\n&quot;</span>);
<a name="l00014"></a>00014         exit(-1);
<a name="l00015"></a>00015     }
<a name="l00016"></a>00016 
<a name="l00017"></a>00017     <span class="keywordflow">while</span>((directorio = readdir(dir)) != NULL &amp;&amp; iguales){
<a name="l00018"></a>00018         <span class="keywordflow">if</span>(strcmp(<span class="stringliteral">&quot;.&quot;</span>,directorio-&gt;d_name)!=0 || strcmp(<span class="stringliteral">&quot;..&quot;</span>,directorio-&gt;d_name)!=0 )
<a name="l00019"></a>00019             strcpy(cadena,carpeta);
<a name="l00020"></a>00020             strcpy(cadena2,carpeta2);
<a name="l00021"></a>00021             strcat(cadena,<span class="stringliteral">&quot;/&quot;</span>);
<a name="l00022"></a>00022             strcat(cadena2,<span class="stringliteral">&quot;/&quot;</span>);
<a name="l00023"></a>00023             strcat(cadena,directorio-&gt;d_name);
<a name="l00024"></a>00024             strcat(cadena2,directorio-&gt;d_name);
<a name="l00025"></a>00025             <span class="keywordtype">char</span>  *p;
<a name="l00026"></a>00026              p = strstr(cadena, <span class="stringliteral">&quot;.e&quot;</span>);
<a name="l00027"></a>00027              <span class="keywordflow">if</span> (p) {
<a name="l00028"></a>00028                  iguales=<a class="code" href="classsgp4__util.html#ae6eadf8401bf34470fce47cbcb6a8c45">comparar</a>(cadena,cadena2);
<a name="l00029"></a>00029              }
<a name="l00030"></a>00030 
<a name="l00031"></a>00031     }
<a name="l00032"></a>00032     <span class="keywordflow">return</span> iguales;
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="classsgp4__util.html#ae6eadf8401bf34470fce47cbcb6a8c45">00037</a> <span class="keywordtype">bool</span> <a class="code" href="classsgp4__util.html#ae6eadf8401bf34470fce47cbcb6a8c45">sgp4_util::comparar</a>(<span class="keywordtype">char</span> fichero[128],<span class="keywordtype">char</span> fichero2[128]) {
<a name="l00038"></a>00038    <span class="keywordtype">char</span> cadena[128];
<a name="l00039"></a>00039    <span class="keywordtype">char</span> cadena2[128];
<a name="l00040"></a>00040    fstream fe(fichero);
<a name="l00041"></a>00041    fstream fe2(fichero2);
<a name="l00042"></a>00042    <span class="keywordtype">int</span> iguales=0;
<a name="l00043"></a>00043    <span class="keywordflow">while</span>(!fe.eof() &amp;&amp; !fe2.eof() &amp;&amp; iguales==0) {
<a name="l00044"></a>00044       fe &gt;&gt; cadena;
<a name="l00045"></a>00045       fe2 &gt;&gt; cadena2;
<a name="l00046"></a>00046       iguales=strcmp(cadena,cadena2);
<a name="l00047"></a>00047    }
<a name="l00048"></a>00048    fe.close();
<a name="l00049"></a>00049    fe2.close();
<a name="l00050"></a>00050    <span class="keywordflow">return</span> (iguales==0);
<a name="l00051"></a>00051 }
<a name="l00052"></a>00052 
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generado el Tue May 22 09:43:43 2012 para sgp4oo por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
